package com.hjj.services;

import com.hjj.beans.DictionaryValue;
import com.hjj.mapper.DictionaryValueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.UUID;

@Service
public class DictionaryValueServicesImp implements DictionaryValueServices{
    @Autowired
    DictionaryValueMapper dictionaryValueMapper;

    @Override
    public ArrayList<DictionaryValue> getAll() {
        return dictionaryValueMapper.getAll();
    }

    @Override
    public DictionaryValue get(String id) {
        return dictionaryValueMapper.get(id);
    }

    @Override
    public boolean add(DictionaryValue dictionaryValue) {
        // 给字典值数据添加UUID
        dictionaryValue.setId(UUID.randomUUID().toString().replace("-", ""));
        return dictionaryValueMapper.add(dictionaryValue) > 0 ? true : false;
    }

    @Override
    public boolean edit(DictionaryValue dictionaryValue) {
        return dictionaryValueMapper.edit(dictionaryValue) > 0 ? true : false;
    }

    @Override
    public boolean del(String[] ids) {
        return dictionaryValueMapper.del(ids) > 0 ? true : false;
    }
}
